#!/bin/bash

if [ ! $1  ]
then
    echo "Usage: $0 <source code path>"
    exit -1 
fi

if [ ! -d $1 ] 
then
    echo "Usage: $0 <source code path>"
    exit -2
fi

echo "-- generate the file list --"
echo ""
find $1 -follow -name "*.[cCxXhHsS]" -print -or -follow -name "*.m4" -print > /home/phil/db/cscope.files
echo "-- generate cscope database --"
echo ""
cscope -bqkU -i /home/phil/db/cscope.files
mv  cscope.* /home/phil/db/
echo "-- generate ctags database --"
echo ""
ctags -L /home/phil/db/cscope.files
mv tags /home/phil/db/
echo "-- done --"
echo ""
